home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13552 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: nntp.teleport.com!usenet
  2. From: GHouck <hksys@teleport.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: File problem with Watcom C/C++ 10.5
  5. Date: 8 Apr 1996 20:28:08 GMT
  6. Organization: systems hk
  7. Message-ID: <4kbsso$sjl@nadine.teleport.com>
  8. References: <4k9fds$4fs@sparcserver.lrz-muenchen.de>
  9. NNTP-Posting-Host: ip-pdx03-45.teleport.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
  14.  
  15. Ralph Reichart <reichart@informatik.tu-muenchen.de> wrote:
  16. >i have a big problem. i'm trying to open a file with fopen. the program 
  17. >looks like this:
  18. >
  19. >#include <stdlib.h>
  20. >#include <stdio.h>
  21. >
  22. >main()
  23. >{
  24. > FILE *Datei;
  25. >
  26. > Datei = fopen("\autoexec.bat", "r");
  27. > if (Datei == NULL)
  28. > {
  29. >  printf("\nSHIT!!");
  30. >  exit(1);
  31. > };
  32. > fclose(Datei);
  33. >}
  34. >
  35. >i'm sorry, but i can't open it. i always have the value -1 or 1 in errno.
  36. Ralph,
  37.  
  38.  
  39. You need a double-backslash in your file-specifications, since a single one
  40. is taken as the escape character (\a):
  41.  
  42.  fopen( "\\autoexec.bat","r" );
  43.  
  44. will result in a single-backslash in the string.
  45.  
  46. Yours, Geoff Houck
  47.  
  48.